<div class="bjui-pageHeader" style="background-color:#fefefe; border-bottom:none;">
    <form data-toggle="ajaxsearch" data-options="{searchDatagrid:$.CurrentNavtab.find('#datagrid-address-list')}">
        <fieldset>
            <legend style="font-weight:normal;">页头搜索：</legend>
            <div style="margin:0; padding:1px 5px 5px;">
                <span>名称：</span>
                <input type="text" name="account_name" class="form-control" size="15">
                <div class="btn-group">
                    <button type="submit" class="btn-green" data-icon="search">开始搜索！</button>
                    <button type="reset" class="btn-orange" data-icon="times">重置</button>
                </div>
            </div>
        </fieldset>
    </form>
</div>
<div class="bjui-pageContent">
    <table class="table table-bordered" id="datagrid-address-list" data-toggle="datagrid" data-options="{
        height: '100%',
        gridTitle : '地址列表',
        toolbarCustom:toolbar,
        showToolbar: true,
        {{--toolbarItem: 'add,export',--}}
        editMode: {dialog:{id:'customer-custom-save', url:'/admin/customer/address-custom-save?customer_id={{$customerId}}', type:'get', title:'客户添加', width:700, height:500}},
        local: 'remote',
        dataUrl: '/admin/customer/address-list',
        postData:{'customer_id':{{$customerId}} },
        editUrl: '/admin/customer/address-save?customer_id={{$customerId}}',
        delUrl: '/admin/customer/address-del',
        delPK: 'id',
        linenumberAll: true,
        sortAll: false,
        contextMenuH: true,
        contextMenuB: false,
        inlineEditMult: false,
        paging: {showPagenum:10, selectPageSize:'20,50,100', pageCurrent:1, pageSize:20},
        showEditbtnscol: '操作',
        customEditbtns: {width:200,position:'replace'},
        fullGrid: true,
        fieldSortable: false,
        filterThead: false,
        columnMenu: false,
        exportOption:{type:'file', options:{url:'admin/customer/address-export', type:'get', data: {_token : '{{ csrf_token() }}'}}}
    }">
        <thead>
        <tr>
            <th data-options="{name:'customer_name',align:'center',width:100}">所属客户</th>
            <th data-options="{name:'consignee',align:'center',width:100}">收货人</th>
            <th data-options="{name:'phone',align:'center',width:100}">电话</th>
            <th data-options="{name:'is_default', type:'select', items:is_default, align:'center',width:100}">是否默认</th>
            <th data-options="{name:'province_name',align:'center',width:100}">省份</th>
            <th data-options="{name:'city_name',align:'center',width:100}">城市</th>
            <th data-options="{name:'area_name',align:'center',width:100}">地区</th>
            <th data-options="{name:'address',align:'center',width:100}">地址</th>
        </tr>
        </thead>
    </table>
</div>
<script>
    function toolbar() {
        return '<button type="button" class="btn-green" data-toggle="dialog" data-options="{id:\'customer-custom-save\', url:\'/admin/customer/address-custom-save?customer_id={{$customerId}}\', type:\'get\', title:\'客户添加\', width:700, height:500}">添加</button>';
    }

    function is_default(){
        return [{'1':'是'}, {'0':'否'}]
    }
</script>